package com.lanyou.cook.util;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

public class SpringWebUtil {

	public static HttpServletRequest getCurrentRequest(){
		RequestAttributes rb = RequestContextHolder.getRequestAttributes();
		if(rb == null || !(rb instanceof ServletRequestAttributes))
			return null;
		ServletRequestAttributes srb = (ServletRequestAttributes)rb;
		return srb.getRequest();
	}
}
